<xsl:stylesheet version="1.1"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="http://www.w3.org/2000/svg">
                
  <xsl:template match="part[type/@name='dog']">
    <g>
      <!-- TODO orientation effects order -->
      <g transform="translate(-20,0)">
        <g transform="rotate(90)">
          <xsl:apply-template select="part[@socket='left-hip']"/>
        </g>
      </g>
      <g transform="translate(20,0)">
        <g transform="rotate(90)">
          <xsl:apply-template select="part[@socket='left-shoulder']"/>
        </g>
      </g>
      <!-- TODO use material type to get fill/outline -->
      <polygon 
        fill="#000" 
        stroke="#000" 
        stroke-width="3"
        points="-25,0 25,0">
      </polygon>   
      <!-- TODO orientation effects order -->
      <g transform="translate(-20,0)">
        <g transform="rotate(90)">
          <xsl:apply-template select="part[@socket='right-hip']"/>
        </g>
      </g>
      <g transform="translate(20,0)">
        <g transform="rotate(90)">
          <xsl:apply-template select="part[@socket='right-shoulder']"/>
        </g>
      </g>
      <g transform="translate(25,0)">
        <g transform="rotate(-45)">
          <xsl:apply-template select="part[@socket='neck']"/>
        </g>
      </g>
      <g transform="translate(-25,0)">
        <g transform="rotate(150)">
          <xsl:apply-template select="part[@socket='tail']"/>
        </g>
      </g>
      
    </g>   
  </xsl:template>        

  <xsl:template match="part[type/@name='dog-tail']">
    <g>
      <polygon 
        fill="#000" 
        stroke="#000" 
        stroke-width="3" 
        points="0,0 20,0" />
    </g>
  </xsl:template>

  <xsl:template match="part[type/@name='dog-neck']">
    <g>
      <polygon 
        fill="#000" 
        stroke="#000" 
        stroke-width="3" 
        points="0,0 20,0" />
      <g transform="translate(20,0)">
        <g transform="rotate(50)">
          <xsl:apply-template select="part[type/@name='head']"/>
        </g>
      </g>
    </g>  
  </xsl:template>
 
  <xsl:template match="part[type/@name='dog-head']">
    <polygon
      fill="#000" 
      stroke="#000" 
      stroke-width="3" 
      points="0,0 15,0" />  
  </xsl:template>
   
  <xsl:template match="part[type/@name='dog-left-arm' or @name='dog-right-arm' or @name='dog-left-leg' or @name='dog-rght-left']">
    <g>
      <polygon 
        fill="#000" 
        stroke="#000" 
        stroke-width="3" 
        points="0,0 25,0" >
      </polygon>
    </g>
  </xsl:template>
            
</xsl:stylesheet>